package com.sqx.modules.errand.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.errand.entity.*;
import com.sqx.modules.errand.vo.IndentVo;
import com.sqx.modules.pay.entity.CashOut;
import com.sqx.modules.pay.entity.PayDetails;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

@Mapper
public interface AdminDao extends BaseMapper<Indent> {

    int findAllCount();

    int findDayAddUser(@Param("date") String date);

    int findMonthAddUser(@Param("date") String date);

    int findYearAddUser(@Param("date") String date);

    BigDecimal findDayIncome(@Param("date") String date);

    BigDecimal findMonthIncome(@Param("date") String date);

    BigDecimal findYearIncome(@Param("date") String date);

    int findIndentCount(@Param("date") String date);


    BigDecimal receivingMoney(@Param("dateType")String dateType, @Param("date") String date, @Param("cityId") Long cityId);

    int billCount(@Param("dateType")String dateType, @Param("date") String date, @Param("cityId") Long cityId);

    int reveivingCount(@Param("dateType")String dateType, @Param("date") String date, @Param("cityId") Long cityId);

    int monthAcceptCount(@Param("userId") Long userId, @Param("date") String date);

    int monthGrantCount(@Param("userId") Long userId, @Param("date") String date);

    BigDecimal monthTopUpMoney(@Param("userId") Long userId, @Param("date") String date);

    BigDecimal monthWithdrawMoney(@Param("userId") Long userId, @Param("date") String date);

    int InviteCount(@Param("invitationCode") String invitationCode, @Param("date") String date);


    IPage<IndentVo> findUserAddIndent(Page<IndentVo> pages, @Param("userId") Long userId);

    IPage<Indent> findUserReceivingIndent(Page<Indent> pages, @Param("userId") Long userId);

    IPage<Indent> taskAnalysisMoney(@Param("pages") Page<Indent> pages, @Param("dateType") String dateType, @Param("date") String date, @Param("indentState") String status, @Param("cityId") Long cityId);


    UserEntity findCertification(@Param("userId") Long userId);

    int updateState(@Param("userId") Long userId, @Param("status") Integer status);

    IPage<UserEntity> findAllUser(@Param("pages") Page<Indent> pages, @Param("phone") String phone, @Param("userType") Integer userType,
                                  @Param("platform") String platform, @Param("nickName") String nickName, @Param("invitationCode") String invitationCode,
                                  @Param("isAgent") Integer isAgent, @Param("onLineFlag") Integer onLineFlag,@Param("inviterCode") String inviterCode);

    int checkCertification(@Param("userId") Long userId, @Param("checkCertification") String checkCertification,@Param("checkCertificationMessage") String checkCertificationMessage);

    IPage<UserEntity> findAllCertification(Page<UserEntity> pages,@Param("nickName")  String nickName, @Param("phone") String phone,@Param("checkCertification") String checkCertification);

    IPage<SysComplaint> findAllAppeal(Page<SysComplaint> pages, @Param("riderUserId")Long riderUserId, @Param("appealMessage") String appealMessage, @Param("indentNumber") String indentNumber , @Param("complaintState") String complaintState);

    int updateComplaintState(@Param("complaintId") Long complaintId, @Param("riderUserId") Long riderUserId, @Param("indentNumber") String indentNumber, @Param("auditMessage") String auditMessage, @Param("complaintState") String complaintState);

    IPage<CashOut> findWithdrawMoney(Page<CashOut> pages, @Param("userId") Long userId);

    IPage<PayDetails> findTopUpMoney(@Param("pages") Page<PayDetails> pages,  @Param("payDetails") PayDetails payDetails, @Param("startTime") String startTime, @Param("endTime") String endTime);

    int updateIndentState(@Param("indentNumber") String indentNumber,@Param("indentState") String indentState);

    IPage<Indent> IndentCenter(@Param("pages") Page<Indent> pages, @Param("indentType") String indentType, @Param("indentNumber")String indentNumber,
                               @Param("indentState")String indentState, @Param("phone") String phone, @Param("date") String date, @Param("dateType") String dateType, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("parentName") String parentName, @Param("parentParentName") String parentParentName);

    List<Indent> exportExcelIndent(@Param("indentType") String indentType, @Param("indentNumber")String indentNumber,
                              @Param("indentState")String indentState, @Param("phone") String phone, @Param("date") String date, @Param("dateType") String dateType,@Param("startTime") String startTime,@Param("endTime") String endTime);


    int adminSoldOutIndent(@Param("indentNumber") String indentNumber);

    IPage<TrainingCenter> adminTrainingCenter(Page<Indent> pages, @Param("title") String title,@Param("type") Integer type);

    int updateAdminTrainingCenter(@Param("trainingId") Long trainingId, @Param("title") String title,@Param("message") String message,@Param("deleteFlag") Integer deleteFlag,@Param("format") String format,@Param("type") Integer type);

    int addAdminTrainingCenter(@Param("title") String title,@Param("message") String message,@Param("deleteFlag") Integer deleteFlag,@Param("format") String format,@Param("type") Integer type);

    IPage<UserMoneyDetails> findUserMoneyDetails(Page<UserMoneyDetails> pages, Long userId);

    BigDecimal riderMoney(@Param("dateType") String dateType,@Param("date") String date);

    BigDecimal platformMoney(@Param("dateType") String dateType,@Param("date") String date);

    int insertMoneyDetails(@Param("userId")Long userId,@Param("title") String title, @Param("content")String content, @Param("type")Integer type, @Param("money")BigDecimal money, @Param("createTime")Timestamp createTime);

    BigDecimal riderMoneySum(Long userId);

    int selectOrderByStatus(@Param("date") String date, @Param("dateType") String dateType, @Param("status") Integer status, @Param("cityId") Long cityId);

    IPage<UserMoneyDetails> selectCashDeposit(Page<UserMoneyDetails> pages, String phone, Integer type, Long userId);

    BigDecimal getUserMoney(Long userId);

    IPage<IndentVo> findAllIndent(@Param("pages") Page<IndentVo> pages, @Param("date") String date, @Param("dateType") String dateType, @Param("indentVo") IndentVo indentVo);

    IPage<Indent> findWaitIndent(Page<Indent> pages, Long userId);

    BigDecimal billMoney(@Param("dateType") String dateType, @Param("date") String date, @Param("cityId") Long cityId);
}
